[on hold] Fix: NOMT verifier state root divergence#2739
Draft
citizen-stig wants to merge 17 commits intodevfrom
Draft
[on hold] Fix: NOMT verifier state root divergence#2739citizen-stig wants to merge 17 commits intodevfrom
citizen-stig wants to merge 17 commits intodevfrom
Conversation
TestCase::routing_bug_minimal reproduces the per-path routing bug fixed by commits 1e0fefd, 306a31b, 5577902 in NomtVerifierStorage. It is a two-round TestCase with two kernel writes per round (and zero user writes), bisected from captured StateAccesses of the slow demo-rollup test_mock_proof_public_data_matches_witnesses down to the minimal input that still makes the pre-fix verifier's verify_multi_proof_update diverge from session.finish().root(). Other additions: - Four additional multi-write/multi-round TestCases for general coverage (multi_write_distinct_keys, multi_write_both_namespaces_distinct, mixed_reads_and_multi_writes, multi_round_multi_write). They don't trigger the routing bug on their own, but exercise code paths the single-write cases didn't. - serde::Serialize / serde::Deserialize derives on StateAccesses and OrderedReadsAndWrites in sov-state::cache, gated behind the test-utils feature. - dump_state_accesses_if_enabled in NomtProverStorage (gated behind test-utils + the SOV_DUMP_STATE_ACCESSES=<dir> env var) for capturing real STF state accesses as JSON. This is how routing_bug_minimal was derived. - serde_json added as optional test-utils-only dep on sov-state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Restores zk_storage.rs and prover_storage.rs to their origin/dev state, undoing the aggregated effect of the three fix commits on these two files. Other changes from those commits (outside these two files) are not present in this branch's ancestry anyway. The dump_state_accesses_if_enabled helper added in the previous commit lived in prover_storage.rs and is wiped by this revert; that is acceptable for this branch because the captures it produced are already inlined into TestCase::routing_bug_minimal. After this commit, running cargo nextest run -p sov-modules-api state_tests::compute_state_update is expected to FAIL: test_roundtrip_nomt panics with a StorageRoot mismatch on the kernel half of routing_bug_minimal, demonstrating the per-path routing divergence between NomtProverStorage (NOMT session.finish) and NomtVerifierStorage (verify_multi_proof_update on a flat update list). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2 tasks
# Conflicts: # examples/demo-rollup/tests/prover/sp1_cpu_prover.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Nomt::MultiProof produced different root hash in certain conditions.
NOMT PR with tests; thrumdev/nomt#931
This PR implements workaround by manually using
Vec<PathProof>insteadCHANGELOG.mdwith a new entry if my PR makes any breaking changes or fixes a bug. If my PR removes a feature or changes its behavior, I provide help for users on how to migrate to the new behavior.Cargo.tomlchanges before opening the PRs. (Are all new dependencies necessary? Is any module dependency leaked into the full-node (hint: it shouldn't)?)Linked Issues
Testing
New tests are added
Docs
No updates